#ifndef _MUNIX_NEWINT_H_
#define	_MUNIX_NEWINT_H_
/*******************************************************************************
 **  Name: newint.h                                                           **
 **  Description:                                                             **
 **                                                                           **
 **  CDDL: Open Source Initiative (OSI) Approved License                      **
 **                                                                           **
 **  Copyright (c) 2009-2010 Barry "Gian" James  <bjames@munixos.net>         **
 **  All rights reserved.                                                     **
 **                                                                           **
 **  The contents of this file are subject to the terms of the CDDL:          **
 **  Common Development and Distribution License (the "License").             **
 **  You may not use this file except in compliance with the License.         **
 **                                                                           **
 **  You can obtain a copy of the license at $PROJECT_ROOT/LICENSE            **
 **  or http://www.opensolaris.org/os/licensing.  This code is Open Source    **
 **  and you are free to use it within the confines of the license, even      **
 **  for your own closed-source commercial projects, as long as you follow    **
 **  the terms set forth in the CDDL.                                         **
 **                                                                           **
 **  When distributing Covered Code, include this CDDL HEADER in each         **
 **  file and include the License file at $PROJECT_ROOT/LICENSE.              **
 **  If applicable, add the following below this CDDL HEADER, with the        **
 **  fields enclosed by brackets "[]" replaced with your own identifying      **
 **  information: Portions Copyright [yyyy] [name of copyright owner]         **
 **                                                                           **
 ******************************************************************************/
#define _MUNIX_NEWINT_H_ID "$Id$"
// Last Modified $DateTime$ by $Author$
#include "common.h"

// Represents a 24-bit flash address
class FlashAddr
{
public:
    FlashAddr() { a[0] = a[1] = a[2] = 0; }
    FlashAddr(const uint32_t);

    FlashAddr &     operator = (const FlashAddr &o);
    FlashAddr &     operator +=(const FlashAddr &o);
    const FlashAddr operator + (const FlashAddr & o) const;
    const FlashAddr operator - (const FlashAddr & o) const;
    const FlashAddr operator * (const FlashAddr & o) const;
    bool            operator ==(const FlashAddr &o) const { return A() == o.A(); }

    uint32_t A() const;
    inline uint8_t A0() { return a[0]; }
    inline uint8_t A1() { return a[1]; }
    inline uint8_t A2() { return a[2]; }
private:
    uint8_t a[3];
};


typedef FlashAddr   uint24;
typedef FlashAddr   SRAMAddr;

#endif	/* _MUNIX_NEWINT_H_ */

